package com.chujian.Adapter;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chujian.model.FoodList;
import com.chujian.orderingsystem.R;

public class OrderHistoryDetailSellerAdapter extends BaseAdapter{
	private List<FoodList>mList;
	private Context context;
	private LayoutInflater mLayoutInflater;
	
	
	public OrderHistoryDetailSellerAdapter(List<FoodList> mList, Context context) {
		super();
		this.mList = mList;
		this.context = context;
		mLayoutInflater=LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder=null;
		if(convertView==null){
			holder=new ViewHolder();
			convertView=mLayoutInflater.inflate(R.layout.order_history_detail_seller_item, null);
			holder.tvFoodName=(TextView) convertView.findViewById(R.id.tv_order_history_detail_s_item_name);
			holder.tvFoodPrice=(TextView) convertView.findViewById(R.id.tv_order_history_detail_s_item_price);
			holder.tvFoodAmout=(TextView) convertView.findViewById(R.id.tv_order_history_detail_s_item_amount);
			convertView.setTag(holder);
		}else{
			holder=(ViewHolder) convertView.getTag();
		}
		convertView.setBackgroundColor(Color.WHITE);
		holder.tvFoodName.setText(mList.get(position).getFoodName());
		holder.tvFoodAmout.setText(mList.get(position).getFoodAmount()+"");
		holder.tvFoodPrice.setText(mList.get(position).getFoodPrice()+"元");
		
		return convertView;
	}
	class ViewHolder{
		public TextView tvFoodName;
		public TextView tvFoodPrice;
		public TextView tvFoodAmout;
	}

}
